package staticDemo2;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2024-09-28
 * Time: 10:25
 */
public class MaxAge {

    private MaxAge(){}

    public static int maxAge(ArrayList<Student> list){
        int maxage = list.get(0).getAge();
        for (int i = 1; i < list.size(); i++) {
            Student student = list.get(i);
            if(maxage < student.getAge()){
                maxage = student.getAge();
            }
        }
        return maxage;
    }
}
